<?php 
session_start();
if (isset($_POST['n']) && isset($_POST['fdes'])){
    $openid=trim(addslashes($_POST['fdes']));
	$nianji=trim(addslashes($_POST['n']));
	$_SESSION['nianji']=$nianji;
	$_SESSION['openid']=$openid;
	
	if ('g3' == $nianji || 'zz' == $nianji){
	    echo json_encode(array('s'=>'end'));
	    exit;
	}
	if ('g1' == $nianji || 'g2' == $nianji){
	    echo json_encode(array('s'=>'end'));
	    exit;
	}
	if ('c3' == $nianji  || 'c2' == $nianji){
	    echo json_encode(array('s'=>'end'));
	    exit;
	}
	if ('c1' == $nianji){
	    echo json_encode(array('s'=>'end'));
	    exit;
	}
	echo json_encode(array('s'=>'end'));
	exit;
	$endTime=strtotime("2020-11-22 19:00:00");
	
	$cha=$endTime - time();
	if ($cha > 0){
	    echo json_encode(array('s'=>'n','t'=>$cha));
	}else{
	    include_once("../c/config.php");
	    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);

	    $thisTable=getC3Table($nianji);

	    $query=$mysqli->query("select id from ".$thisTable." where openid='".$openid."'  limit 0, 1");
	    if($query->num_rows>0){
	        echo json_encode(array('s'=>'has'));
	    }else{
	        echo json_encode(array('s'=>'k','t'=>$cha));
	    }
	 
	    
	}
	
	
	
	
	
}else{
    echo json_encode(array('s'=>'n'));
}
?>